package com.cershy.linyuminiserver.dto;

public class DeviceDto {
    private String name;
    private Integer type;
    private double x;
    private double y;
    private Integer isImp;
    private String deviceCode;

    public DeviceDto(String name, Integer type, double x, double y, Integer isImp,String dc) {
        validateCoordinates(x, y);
        this.name = name;
        this.type = type;
        this.x = x;
        this.y = y;
        this.isImp = isImp;
        deviceCode=dc;
    }

    private void validateCoordinates(double x, double y) {
        if (x < -180 || x > 180) {
            throw new IllegalArgumentException("经度坐标异常，合法范围是 -180 到 180");
        }
        if (y < -90 || y > 90) {
            throw new IllegalArgumentException("纬度坐标异常，合法范围是 -90 到 90");
        }
    }

    public String getName() {
        return name;
    }

    public Integer getType() {
        return type;
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }

    public Integer getIsImp() {
        return isImp;
    }

    public String getDeviceCode() {
        return deviceCode;
    }
}

